package com.qinggeng.project.api.controller;

import com.qinggeng.framework.web.domain.AjaxResult;
import com.qinggeng.project.api.dto.WithdrawaltDTO;
import com.qinggeng.project.api.security.annotation.LoginRequired;
import com.qinggeng.project.api.security.utils.ApiUtils;
import com.qinggeng.project.system.service.UserAccountRecordWithdrawalService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("${apiPath}/withdrawal")
public class ApiUserAccountRecordWithdrawalController {
    @Resource
    private UserAccountRecordWithdrawalService userAccountRecordWithdrawalService;

    //零钱提现
    @PostMapping
    @LoginRequired
    public AjaxResult withdrawal(WithdrawaltDTO withdrawaltDTO) {
        Long userId=ApiUtils.getUserId();
        withdrawaltDTO.setUserId(userId);
        userAccountRecordWithdrawalService.withdrawal(withdrawaltDTO);
        return AjaxResult.success();
    }

}
